<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:r="http://ricchieri.com/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="../../templates/commonLayoutOther.xhtml">
		<ui:define name="title">#{msg.titleOther}</ui:define>
		<ui:define name="content">
		     <h:form id="searchEmailTemplateForm">
		     		<h:messages style="color:red;margin:8px;" /> 
		     		<h2>#{msg.searchEmailTemplate}</h2>     
			     	<h:panelGrid columns="2">
			     		<h:outputLabel value="#{msg.emailType}"/>
			     		<p:selectOneMenu id="emailType" value="#{searchEmailTemplateMB.emailTemplateFilter.emailTemplateType}">
			     			<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
		                	<f:selectItems value="#{searchEmailTemplateMB.templateType}" />   
		            	</p:selectOneMenu> 

					</h:panelGrid>
					<h:panelGrid columns="2" style="margin-top:10px; text-align:center">
		     			<r:commandLinkCustom id="reset" action="#{searchEmailTemplateMB}" method="reset" icon="icon-eraser" message="#{msg.resetButton}"/>
	     				<r:commandLinkCustom id="search" action="#{searchEmailTemplateMB}" method="search" icon="icon-search" message="#{msg.searchButton}"/>
		     	 	</h:panelGrid>
		     	 	
		     	 	
		     	 	<p:blockUI block="emailTemplateTable" trigger="emailTemplateTable">  
				        #{msg.loading}<br />  
				        <p:graphicImage value="/images/ajax-loader.gif"/>  
				    </p:blockUI>
		     	 	<p:dataTable var="template" value="#{searchEmailTemplateMB.emailTemplateLazyDataModel}" 
		     	 		paginator="true" lazy="true" id="emailTemplateTable"
		     	 		rows="10"
		     	 		paginatorPosition="bottom" emptyMessage="#{msg.noRecordsFound}"
		     	 		style="padding-top:15px">
		 		 
		 				<p:column headerText="#{msg.emailType}" style="width:20%">  
			            	<h:outputText value="#{searchEmailTemplateMB.obtainDescription(template.emailToSendType.description)}" />   
		        		</p:column> 
		        		
		        		<p:column headerText="#{msg.subject}" styleClass="truncate">  
			            	<h:outputText value="#{template.subject}" />   
		        		</p:column> 
		        		
		        		<p:column headerText="#{msg.emailTemplate}" styleClass="truncate">  
			            	<h:outputText value="#{template.template}" />   
		        		</p:column> 
		        		
		        		<p:column headerText="Principal" styleClass="truncate">  
			            	<h:outputText value="#{searchEmailTemplateMB.obtainBooleanDescription(template.isDefault)}" />   
		        		</p:column> 

		        		<p:column headerText="#{msg.actions}" style="width:15%">
		        			<center>
			        			<h:commandLink action="#{searchEmailTemplateMB.viewEmailTemplate(template)}" ajax="false" process="@form">
		        					<i class="icon-zoom-in icon-2x color-zoom"></i>
		        				</h:commandLink>
		        				<r:space/><r:space/>
		        				
			        			<h:commandLink action="#{searchEmailTemplateMB.editEmailTemplate(template)}"  ajax="false" process="@form">
		        					<i class="icon-edit icon-2x color-edit"></i>
		        				</h:commandLink>
								<r:space/><r:space/>
								
			        			<p:commandLink oncomplete="deleteEmailTemplate.show();" action="#{searchEmailTemplateMB.showDialog(template)}">
			        				<i class="icon-remove-sign icon-2x color-delete"></i>
		        				</p:commandLink>
		        				<r:space/><r:space/>
		        			</center>
		        		</p:column>  
				    </p:dataTable>
		     	 	
		     	 	<p:confirmDialog id="confirmDialogDel" message="#{msg.deleteMessage}"  
				                header="#{msg.deleteProcessHeader}" severity="alert" widgetVar="deleteEmailTemplate"> 
				    	<center> 
				        	<p:commandButton id="confirmdelete" value="#{msg.yesMessage}" oncomplete="deleteEmailTemplate.hide()" action="#{searchEmailTemplateMB.delete()}" update="@form" partialSubmit="true" process="@form" />  
				        	<p:commandButton id="declinedelete" value="#{msg.noMessage}" oncomplete="deleteEmailTemplate.hide()" action="#{searchEmailTemplateMB.unselect()}"/>     
				    	</center>       
				    </p:confirmDialog>  
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>
